//
//  UILabel+TMColorText.m
//  国学培训用户端
//
//  Created by Tao Li on 2018/7/17.
//  Copyright © 2018年 mac. All rights reserved.
//

#import "UILabel+TMColorText.h"

@implementation UILabel (TMColorText)
- (void)displayTextWithText:(NSString *)text AndRange:(NSRange)range AndFont:(NSInteger)font AndColor:(UIColor *)color{
    NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:text]; //创建一个NSMutableAttributedString
    [str addAttribute:NSForegroundColorAttributeName value:color range:range]; // 关键步骤，设置指定位置文字的颜色
    
    [str addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:font] range:range]; //关键步骤，设置指定位置文字的字号大小
    self.attributedText = str;
    
}

@end
